﻿using System;
using MCInsertDb.Model;
using System.Data.OracleClient;


namespace MCInsertDb.DAL
{
    public class TGS_DATADAL
    {
        public int Insert(TGS_DATA tgs_data,String tableName)
        {
            int returnValue = 0;
            //插ID？

            returnValue = SqlHelper.ExecuteNonQuery("INSERT INTO " + tableName +
                        @"(ID, CARTYPE, CARNUM, PASSDATE, ADDRESSCODE, DEPARTMENTCODE, DATASOURCE, DEVICECODE, LANENUM, CARSPEED, PIC1, PIC2, 
                            DIRID, TYPECOLOR, DEVICEID)
                 VALUES
                       (:ID, :CARTYPE, :CARNUM,:PASSDATE,:ADDRESSCODE,:DEPARTMENTCODE,:DATASOURCE, :DEVICECODE,:LANENUM,:CARSPEED,:PIC1,
                        :PIC2,:DIRID,:TYPECOLOR,:DEVICEID)",
                new OracleParameter(":ID", tgs_data.Id),
                new OracleParameter(":CARTYPE", tgs_data.Cartype),
                new OracleParameter(":CARNUM", tgs_data.Carnum),
                new OracleParameter(":PASSDATE", tgs_data.Passdate),
                new OracleParameter(":ADDRESSCODE", tgs_data.Addresscode),
                new OracleParameter(":DEPARTMENTCODE", tgs_data.Departmentcode),
                new OracleParameter(":DATASOURCE", tgs_data.Datasource),
                new OracleParameter(":DEVICECODE", tgs_data.Devicecode),
                new OracleParameter(":LANENUM", tgs_data.Lanenum),
                new OracleParameter(":CARSPEED", tgs_data.Carspeed),
                new OracleParameter(":PIC1", tgs_data.Pic1),
                new OracleParameter(":PIC2", tgs_data.Pic2),
                new OracleParameter(":DIRID", tgs_data.Dirid),
                new OracleParameter(":TYPECOLOR", tgs_data.Typecolor),
                new OracleParameter(":DEVICEID", tgs_data.Deviceid));
            return returnValue;
        }
    }
}
